package com.dhecp.project.hr.controller;

import com.dhecp.common.core.controller.BaseController;
import com.dhecp.core.constant.ModuleTable;
import com.dhecp.project.api.util.ApiConfig;
import com.dhecp.project.hr.domain.DataExecution;
import com.dhecp.project.hr.service.DataExecutionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/common/dataExecution")
public class DataExecutionController extends BaseController {

    private String prefix = "hr/amazonshoporder";
    private String moduleTable = ModuleTable.DATAEXECUTION;

    @Autowired
    private DataExecutionService dataExecutionService;


    /**
     * 获取数据执行报告
     * @return
     */
    @GetMapping("/list")
    public ModelAndView list() throws Exception{
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("moduleTable", moduleTable);
        ModelAndView mv = new ModelAndView();
        mv.setViewName(prefix + "/dataExecutionReport");
        List<DataExecution> dataExecutions = dataExecutionService.queryDataExecutionList(params);
        mv.addObject("dto", dataExecutions);
        mv.addObject("ali1688EcpApiUrl", ApiConfig.getUrlAdmin1_5());
        return mv;
    }
}
